-
Notifications
You must be signed in to change notification settings - Fork 2.8k
[OV CPU] Convert Node converting integer to unsigned one, it did clamp #32389
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
bopeng1234
merged 7 commits into
openvinotoolkit:master
from
bopeng1234:convert_int32_to_uint32
Oct 28, 2025
Merged
[OV CPU] Convert Node converting integer to unsigned one, it did clamp #32389
bopeng1234
merged 7 commits into
openvinotoolkit:master
from
bopeng1234:convert_int32_to_uint32
Oct 28, 2025
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Contributor
Author
|
build_jenkins |
Contributor
Author
|
build_jenkins |
1 similar comment
Contributor
|
build_jenkins |
Contributor
|
build_jenkins |
a003adf to
fff566e
Compare
a16e4bf to
5323327
Compare
Contributor
|
@nshchego, could you please review this PR? |
nshchego
reviewed
Oct 23, 2025
src/plugins/intel_cpu/tests/functional/custom/single_layer_tests/classes/conversion.cpp
Outdated
Show resolved
Hide resolved
nshchego
reviewed
Oct 23, 2025
src/plugins/intel_cpu/tests/functional/custom/single_layer_tests/classes/conversion.cpp
Outdated
Show resolved
Hide resolved
40615e7 to
3c14015
Compare
praasz
reviewed
Oct 24, 2025
217d82e to
dd79cc5
Compare
nshchego
approved these changes
Oct 27, 2025
praasz
approved these changes
Oct 27, 2025
Merged
via the queue into
openvinotoolkit:master
with commit Oct 28, 2025
2b7d228
236 of 239 checks passed
azhai219
pushed a commit
to azhai219/openvino
that referenced
this pull request
Nov 3, 2025
openvinotoolkit#32389) As Convert Op's [Specification ](https://docs.openvino.ai/2025/documentation/openvino-ir-format/operation-sets/operation-specs/type/convert-1.html) said. > Conversion of negative signed integer to unsigned integer value happens in accordance with c++ standard. Notably, result is the unique value of the destination unsigned type that is congruent to the source integer modulo 2^N (where N is the bit width of the destination type). **For example, when an int32 value -1 is converted to uint32 the result will be uint32 max which is 4,294,967,295.** ### Reproduce: Test when int32 value -1 convert to uint8 - OV GPU/NPU, got 255 (match the spec) - OV CPU, it uses the boundary to clamp, got 0, not 255 (did't match the spec) ``` import openvino as ov import numpy as np input_data = np.full((2, 2), -1, dtype=np.int32) expected_output_data = np.full((2, 2), 2**8 - 1, dtype=np.uint8) input_param = ov.op.Parameter(ov.runtime.Type.i32, ov.Shape([2, 2])) convert_op = ov.opset1.convert(input_param, destination_type=ov.runtime.Type.u8) model = ov.Model(results=[convert_op], parameters=[input_param], name="int32_to_uint8_convert") core = ov.Core() compiled_model = core.compile_model(model, "CPU") results = compiled_model(input_data) actual_output_data = results[compiled_model.outputs[0]] try: print("--- Verification ---") np.testing.assert_array_equal(actual_output_data, expected_output_data) print("SUCCESS: Actual output matches expected output.") except AssertionError as e: print(f"FAILED: Output mismatch!\n{e}") ``` ``` --- Verification --- FAILED: Output mismatch! Arrays are not equal ... ACTUAL: array([[0, 0],[0, 0]], dtype=uint8) DESIRED: array([[255, 255],[255, 255]], dtype=uint8) ``` ### Tickets: - *CVS-172796*
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
category: CPU
OpenVINO CPU plugin
category: IE Tests
OpenVINO Test: plugins and common
category: ONNX FE
OpenVINO ONNX FrontEnd
Code Freeze
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
As Convert Op's Specification said.
Reproduce:
Test when int32 value -1 convert to uint8
Tickets: